public class SelectionSort {
    public static void main(String[] args) {
        int[] arr = {64, 34, 25, 12, 22, 11, 90};
        selectionSort(arr);
        for (int num : arr) {
            System.out.print(num + " ");
        }
    }

    public static void selectionSort(int[] arr) {
        int L = arr.length;
        for (int i = 0; i < L - 1; i++) {
            int m = i;
            for (int j = i + 1; j < L; j++) {
                if (arr[j] < arr[m]) {
                    m = j;
                }
            }
            if (m != i) {
                int temp = arr[i];
                arr[i] = arr[m];
                arr[m] = temp;
            }
        }
    }
}